Skip to content

Conversation

lenko-d
Copy link
Contributor

@lenko-d lenko-d commented Oct 14, 2023

The problem is that we are not handling ConstKind::Expr inside report_not_const_evaluatable_error

Fixes [#114151]

@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 14, 2023
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2023

Some changes occurred in const_evaluatable.rs

cc @BoxyUwU

@BoxyUwU BoxyUwU assigned BoxyUwU and unassigned wesleywiser Oct 23, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented Oct 30, 2023

I dont think this is the right solution. It's fine for is_const_evaluatable to fail for ConstKind::Expr. Instead report_not_const_evaluatable_error should avoid ICEing on ConstKind::Expr

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 30, 2023
@lenko-d lenko-d force-pushed the const_evaluatable_failed_for_non_unevaluated_const branch from e43e5d0 to 9d4ab9d Compare November 3, 2023 06:45
@lenko-d lenko-d changed the title dont ICE when ConstKind::Expr for is_const_evaluatable and a non region param dont ICE when ConstKind::Expr for is_const_evaluatable Nov 3, 2023
@lenko-d
Copy link
Contributor Author

lenko-d commented Nov 3, 2023

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 3, 2023
};
Some(err)
}
ty::ConstKind::Expr(_) => None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should still actually emit an error for these failures imo

@lenko-d lenko-d force-pushed the const_evaluatable_failed_for_non_unevaluated_const branch from 9d4ab9d to 4a7da1a Compare November 19, 2023 19:02
@lenko-d lenko-d requested a review from BoxyUwU November 19, 2023 23:29
let mut err = self
.tcx
.sess
.struct_span_err(span, "evaluation of ConstKind::Expr is not supported");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ConstKind::Expr" is not something that should be exposed to users. really the message should be the same as for ConstKind::Unevaluated except that instead of using the source map stuff we should just print the const out using {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rustbot ready

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2023
@lenko-d lenko-d force-pushed the const_evaluatable_failed_for_non_unevaluated_const branch from 4a7da1a to 69a2bd6 Compare December 9, 2023 16:21
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 9, 2023
@lenko-d lenko-d requested a review from BoxyUwU December 9, 2023 19:31
@BoxyUwU
Copy link
Member

BoxyUwU commented Dec 12, 2023

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 12, 2023

📌 Commit 69a2bd6 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2023
@BoxyUwU BoxyUwU added the A-const-generics Area: const generics (parameters and arguments) label Dec 12, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#116740 (dont ICE when ConstKind::Expr for is_const_evaluatable)
 - rust-lang#117914 (On borrow return type, suggest borrowing from arg or owned return type)
 - rust-lang#117927 (Clarify how to choose a FutureIncompatibilityReason variant.)
 - rust-lang#118855 (Improve an error involving attribute values.)
 - rust-lang#118856 (rustdoc-search: clean up parser)
 - rust-lang#118865 (rustc_codegen_llvm: Enforce `rustc::potential_query_instability` lint)
 - rust-lang#118866 (llvm-wrapper: adapt for LLVM API change)
 - rust-lang#118868 (Correctly gate the parsing of match arms without body)
 - rust-lang#118877 (tests: CGU tests require build-pass, not check-pass (remove FIXME))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b2a0175 into rust-lang:master Dec 12, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 12, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
Rollup merge of rust-lang#116740 - lenko-d:const_evaluatable_failed_for_non_unevaluated_const, r=BoxyUwU

dont ICE when ConstKind::Expr for is_const_evaluatable

The problem is that we are not handling ConstKind::Expr inside report_not_const_evaluatable_error

Fixes [rust-lang#114151]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants